home *** CD-ROM | disk | FTP | other *** search
/ HAM Radio 1997 / HAM Radio 1997.iso / vcls / redistry / registry.int < prev    next >
Text File  |  1996-04-08  |  5KB  |  113 lines

  1. unit Registry;
  2.  
  3. {
  4.  LEGALIES
  5.  
  6.      Borland Delphi TRegistry component 1.01 (version 1.0 revision 1)  July 12, 1995
  7.      (c)opyright elite!developments 1995. all rights reserved.
  8.      written by marc hoffman <marc@arb-phys.uni-dortmund.de>
  9.  
  10.      requires Windows95. does NOT require Delphi 95.
  11.  
  12.      this package is freeware. you may use TRegistry in your applications and distribute
  13.      these applications as you wish, without any licensing fee.
  14.      you may distribute this package as you will, too, as long as no part of it is due
  15.      to any changes unautorized by elite!developments.
  16.      the exclusive (c)opyrights to this entire package belong to elite!developments.
  17.  
  18.      elite!developments, elite@elitedev.bluebocs.donut.ruhr.com, +49.(0)231.737627
  19.  
  20.  
  21.      Borland Delphi is a registered trademak of Borland International Inc.
  22.  
  23.  WHAT IS TRegistry?
  24.  
  25.      TRegistry is ccomponent for Delphi that allows you to store infrmation needed by
  26.      your application in the system registry of Win95 (and possibly WindowsNT), just
  27.      as applications under Win3.1 would have used the .INI files.
  28.  
  29.      TRegistry is NOT a component to access the entire system registry. for such a
  30.      component look out for future releases of elite!developments.
  31.  
  32.  WHY SHOULD I USE THE REGISTRY INSTEAD OF .INI FILES?
  33.  
  34.      there are several reasons:
  35.  
  36.        1. Microsoft encourages the use of the system registry and has implemented the
  37.           .INI functionality in Win95 only to remain compatibility with older applications
  38.           chances are future versions of Win will not provide and .INI capabilities.
  39.  
  40.        2. the registry offers several advantages over .INI files
  41.            -nested strcuture of information. in the system registry you can have keys
  42.             within keys within keys within... you catch de draft, whilst in .INI files you
  43.             only have one depth of sections and keys.
  44.            -user specific data. if the Win95 system is set to store different profiles
  45.             for each user, you can write userdependent data into the reggistry and
  46.             TRegistry will automatically access the data of the current user.
  47.  
  48.  HOW DO I IMPLEMENT TRegistry?
  49.  
  50.      nothing simpler than that.
  51.      after you have installed the component in Delphis component palette, you can simply
  52.      drop in onto a form and set it's properties.
  53.  
  54.      namely, you should set the ApplicationName and CompanyName properties, since TREgistry
  55.      will create a unique key name to store all your data under. feel free to use your full
  56.      company and application name, and not just abreviations, to assure individuality.
  57.      this key prevents both applications from other developers and your own aplications to
  58.      interfere in the registry.
  59.  
  60.      once this is done, you can call the ReadString/WriteString methods to access keys in the
  61.      registry.
  62.  
  63.      ReadString reads a key from the registry, ReadStringUser reads a string from the user-specific
  64.      part of the registry. notice that these two sections do not overlap. so you can have an
  65.      identical key-name in both sections, but access different data, ReadString accessing the
  66.      global data and ReadStringUser accessing the user specific data.
  67.      if a key accessed by ReadString/ReadStringUser does not exists, TRegistry raises an
  68.      ERegistryError exception. check the Delphi documentation for details on how to handle
  69.      exceptions.
  70.  
  71.      WriteString and WriteStringUser write a ke to the gloabl and user specific part of the
  72.      registry, respectively. if a key written to does not exist, it is created.
  73.  
  74.      The RootKey and RootKeyUser properties are read only properties you can use to check the
  75.      which place in the registry your information will be stored in
  76.  
  77.      if any questions come up concerning TRegistry, feel free to contact me at
  78.  
  79.        marc@abr-phys.uni.dortmund.de (preferred)
  80.        marc@elitedev.bluebocs.donut.ruhr.com
  81.        marc@2:2444/1007.123@fido.net (fido)
  82.  
  83.  COMING SOON:
  84.  
  85.        TFileRegistry (registering file types, including Shell & DDE protocols)
  86.        TRegistry 1.5 (access to Win95 specific types of registry entries (binaries, dwords)
  87.        TRegEdit      (component for full access to the registry)
  88.  
  89.      the latter two can be expected as soon as i get some decent Win95 developers docu.
  90.      i mean...who the hell has enuff spare money to subscribe to MSDN? :-)
  91. }
  92.  
  93. type
  94.   ERegistryError = class(Exception)
  95.   end;
  96.  
  97.   TRegistry = class(TComponent)
  98.   protected
  99.   public
  100.     constructor Create(AOwner:TComponent);                            override;
  101.     destructor  Destroy;                                              override;
  102.     procedure WriteString(key,value:string);
  103.     procedure WriteStringUser(key,value:string);
  104.     function ReadString(key:string):string;
  105.     function ReadStringUser(key:string):string;
  106.   published
  107.     property ApplicationName:string read write;
  108.     property CompanyName:string read write;
  109.     property RootKey:string read;
  110.     property RootKeyUser:string read;
  111.   end;
  112. end.
  113.